<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点击换肤</button>
    <script>
        function getRandom ( max , min ) {
            var res = parseInt(Math.random() * ( max + 1 - min )) + min ; 
            return res ; 
        }
        var a = getRandom(9,1);
        document.body.style.background = `url(../images/${a}.jpg) no-repeat center 10px/1300px 700px`;
        var btn = document.querySelector("button");
        btn.onclick = function () {
            document.body.style.background = `url(../images/${res}.jpg) no-repeat center 10px/1300px 700px`;
        }
    </script>
</body>
</html>